﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Business;
using System.Data;

public partial class client_GetTrendReportImage : @base
{

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //this.MasterPageFile = "";
            DataTable dt = (DataTable)Session["ReportValue"];
            //dt.DefaultView.Sort = "x";
            //this.Page

            int total = dt.Rows.Count + 1;
            LineChart c = new LineChart(480, 400, this.Page);
            c.strTitle = "Trend Report";
            c.ftXorigin = 0;
            c.ftScaleX = total;
            c.ftXdivs = total;
            c.ftYorigin = 0;
            c.ftScaleY = 200;
            c.ftYdivs = 10;
            int i = 0;

            foreach (DataRow r in dt.Rows)
            {
               // string month = (r["x"].ToString()).Substring(0, 10);
                string label = r["x"].ToString();
                //string[] sectors = label.Split('/');
                //string day = sectors[0];
                //string mon = sectors[1];
                //string year = sectors[2].Substring(2);
                //label = "" + day + "/" + mon + "/" + year;
                int matrix = ToInt(r["y"].ToString());
                i++;
                c.AddValue(i, matrix, label);

            }
            /* c.AddValue(10, 50);
             c.AddValue(20, 100);
             c.AddValue(30, 150);
             c.AddValue(20, 200);*/
            c.Draw();
       

        
            
                
                    //if (!Page.ClientScript.IsStartupScriptRegistered("redir"))
                    //    Page.ClientScript.RegisterStartupScript(this.GetType(), "redir",
                    //        @"<script type=""text/javascript""> if (top.window) { top.window.location.href = '../Default.aspx'; } </script>");

                
           
        }
        
    }
}
